<?php

/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| Here is where you can register web routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| contains the "web" middleware group. Now create something great!
|
*/
Route::get('/',      'IndexController@index');
Route::get('gallery','IndexController@gallery');
Route::any('wechat',     'WechatController@serve');
Route::any('wxuser-info','WechatController@index')->middleware(['wechat.oauth:default,snsapi_userinfo']);
Route::prefix('zadmin')->namespace('Admin')->group(function(){
	Route::get('login',     'LoginController@login');
 	Route::any('logindo',   'LoginController@loginDo');
 	Route::any('upload',   'IndexController@upload');
 	Route::post('img-upload','IndexController@imgUpload');
 	Route::middleware('checkAdmin')->group(function(){
 		
		Route::resource('admins',	'AdminController');
		Route::resource('system',   'SystemController');				
		Route::resource('cate',		'CateController');
		Route::resource('role',		'RoleController');
		Route::resource('banner',	'BannerController');
		Route::resource('product-imgs',	'ProductImgController');
		Route::resource('tag',		'TagController');
		Route::resource('notice',		'NoticeController');
		Route::get('index',			'IndexController@index');
		Route::get('test',			'IndexController@test');
		Route::resource('menu',		'MenuController');
		Route::get('menu/permission/{id}','MenuController@menuPermission');
		//Route::resource('permission',	  'PermissionController');

		Route::resource('materials',		'ProductMaterialController');
		Route::prefix('users')->group(function(){
			Route::get('list',		'UserController@index');
			Route::get('create',		'UserController@create');
			Route::post('save',	'Usercontroller@save');
			Route::post('update',	'Usercontroller@update');
			Route::get('show/{user_id}',     	'UserController@show');
			
			
			Route::get('address/{user_id}',   'UserController@address');
			
			Route::post('change-status',      'Usercontroller@changeStatus'); // 停用账号
		});

		
		


		Route::prefix('products')->group(function(){
			Route::get('add',         'ProductController@add');
			Route::get('edit',		  'ProductController@edit');
			Route::post('save',		  'ProductController@save');
			Route::post('update',	  'ProductController@update');
			Route::post('sale-status','ProductController@saleStatus');
			Route::get('change-rec','ProductController@changeRec');
			Route::delete('delete/{id}','ProductController@destroy');
			Route::get('thumb',			'ProductController@setThumb');
			Route::get('spec' ,         'ProductController@spec');
			Route::post('spec-save',    'ProductController@specSave');

			Route::get('make-zip','ProductController@makeZip');
			
			Route::get('/',             'ProductController@index');


		});

		Route::prefix('order')->group(function(){
			Route::get('detail/{order_id}','OrderController@detail');
			Route::get('confirm',  'OrderController@confirm');
			Route::get('reject',   'OrderController@reject');
			Route::post('send',    'OrderController@send');
			Route::get('complete', 'OrderController@complete');
			Route::get('export',   'OrderController@export');
			Route::get('/',		   'OrderController@index');
		});

		// 退款
		Route::resource('refunds',	  'OrderRefundController');

		Route::get('tplmsg/list','TplMsgController@index');


		Route::prefix('wechat')->group(function(){
			Route::get('wxuser/pull',  'WxuserController@pull');
			Route::get('wxuser/import',  'WxuserController@import');
			Route::post('wxuser/save-user','WxuserController@saveToUser');
			Route::resource('wxuser',  'WxuserController');
		});	

		Route::get('/','IndexController@dashboard');
	});
});



